package com.jy.rhin.infra.repo.document.submission.assembler;

import com.jy.rhin.domain.document.submission.entity.RhinCodeableVO;

import java.util.Objects;
import java.util.function.Function;

/**
 * @author WeiQ
 * @date 2022/6/8 12:24
 */
public class RhinCodeableAssembler {
    private RhinCodeableAssembler() {
    }

    public static <T> String getCodeText(Function<T, RhinCodeableVO> getter, T vo) {
        RhinCodeableVO apply = getter.apply(vo);
        if (Objects.nonNull(apply)) {
            return apply.getCoding().get(0).getDisplayName();
        }
        return null;
    }
}
